using System;
using System.Data;
using System.Collections.Generic;

namespace SERP.DAO{
	/********************************BEGIN MenusDAO****************************************/
	///<summary>
	/// <para>Author: Auto generated class by CSharp Code Generator v2.0</para>
	/// <para>Date:09/03/2013 19:09:04</para>
	/// <para>Class Name: MenusDAO</para>
	/// <para>Description: Class access to table Menus in database. Coder should'nt code here.</para>
	///</summary>

	
	public partial class MenusDAO : DAOBase<MenusEntity>{


		#region Select functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateSelectOneCommand</para>
		/// <para>Input: MenuId</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectOneCommand(int MenuId){
			string strSQL="SELECT  [MenuId],[ParentId],[ModuleId],[MenuName],[Description],[IconName],[MenuUrl],[DisplayIndex] FROM [Menus]  WHERE [Menus].[MenuId]=@MenuId";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@MenuId",MenuId);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: SelectOne</para>
		/// <para>Input: MenuId</para>
		/// <para>Output: MenusEntity</para>
		///</summary>
		public MenusEntity SelectOne(int MenuId){
			IDbCommand cmd=this.CreateSelectOneCommand(MenuId);
			return this.Select(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateSelectAllCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllCommand(){
			string strSQL="SELECT  [MenuId],[ParentId],[ModuleId],[MenuName],[Description],[IconName],[MenuUrl],[DisplayIndex] FROM [Menus] ";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateSelectAllByKeyCommand</para>
		/// <para>Input: ColumnName,ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllByKeyCommand(string ColumnName,object Value){
			string strSQL="SELECT  [MenuId],[ParentId],[ModuleId],[MenuName],[Description],[IconName],[MenuUrl],[DisplayIndex] FROM [Menus]  WHERE [Menus].["+ColumnName+"]=@ColumnName";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: SelectAll</para>
		/// <para>Input: </para>
		/// <para>Output: List of MenusEntity</para>
		///</summary>
		public List<MenusEntity> SelectAll(){
			IDbCommand cmd=this.CreateSelectAllCommand();
			return this.SelectList(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: SelectAllDS</para>
		/// <para>Input: </para>
		/// <para>Output: DataSet</para>
		///</summary>
		public DataSet SelectAllDS(){
			IDbCommand cmd=this.CreateSelectAllCommand();
			return this.SelectDS(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateSelectAllFilterCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllFilterCommand(string strFilter){
			string strSQL="SELECT  [MenuId],[ParentId],[ModuleId],[MenuName],[Description],[IconName],[MenuUrl],[DisplayIndex] FROM [Menus]  WHERE "+RemoveInjection(strFilter);
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateSelectAllByKeyFilterCommand</para>
		/// <para>Input: ColumnName,ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateSelectAllByKeyFilterCommand(string strFilter,string ColumnName,object Value){
			string strSQL="SELECT  [MenuId],[ParentId],[ModuleId],[MenuName],[Description],[IconName],[MenuUrl],[DisplayIndex] FROM [Menus]  WHERE [Menus].["+ColumnName+"]=@ColumnName AND "+RemoveInjection(strFilter);
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: SelectAll</para>
		/// <para>Input: </para>
		/// <para>Output: List of MenusEntity</para>
		///</summary>
		public List<MenusEntity> SelectAllFilter(string strFilter){
			IDbCommand cmd=this.CreateSelectAllFilterCommand(strFilter);
			return this.SelectList(cmd);
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: SelectAllDSFilter</para>
		/// <para>Input: </para>
		/// <para>Output: DataSet</para>
		///</summary>
		public DataSet SelectAllDSFilter(string strFilter){
			IDbCommand cmd=this.CreateSelectAllFilterCommand(strFilter);
			return this.SelectDS(cmd);
		}
		#endregion

		#region Insert functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateInsertCommand</para>
		/// <para>Input: MenusEntity</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateInsertCommand(MenusEntity o){
			string strSQL="INSERT INTO [Menus]([ParentId],[ModuleId],[MenuName],[Description],[IconName],[MenuUrl],[DisplayIndex]) VALUES  (@ParentId,@ModuleId,@MenuName,@Description,@IconName,@MenuUrl,@DisplayIndex);SELECT  @@IDENTITY";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullParentId)
				this.CreateCommandParameter(cmd,"@ParentId",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ParentId",o.ParentId);

			if(o.IsNullModuleId)
				this.CreateCommandParameter(cmd,"@ModuleId",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ModuleId",o.ModuleId);

			if(o.IsNullMenuName)
				this.CreateCommandParameter(cmd,"@MenuName",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MenuName",o.MenuName);

			if(o.IsNullDescription)
				this.CreateCommandParameter(cmd,"@Description",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@Description",o.Description);

			if(o.IsNullIconName)
				this.CreateCommandParameter(cmd,"@IconName",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@IconName",o.IconName);

			if(o.IsNullMenuUrl)
				this.CreateCommandParameter(cmd,"@MenuUrl",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MenuUrl",o.MenuUrl);

			if(o.IsNullDisplayIndex)
				this.CreateCommandParameter(cmd,"@DisplayIndex",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@DisplayIndex",o.DisplayIndex);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: Save</para>
		/// <para>Input: MenusEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Save(MenusEntity o){
			bool result=false;
			IDbCommand cmd=this.CreateInsertCommand(o);
			object id=this.ExecuteScalar(cmd,ref result);
			cmd.Dispose();
			try{
				o.MenuId=int.Parse(Convert.ToString(id));
			}
			catch{}
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: SaveList</para>
		/// <para>Input: List of MenusEntity</para>
		/// <para>Output: </para>
		///</summary>
		public void SaveList(List<MenusEntity>list){
			foreach(MenusEntity o in list){
				try{
					this.Save(o);
				}
				catch{
				}
			}
		}
		#endregion

		#region Update functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateUpdateCommand</para>
		/// <para>Input: MenusEntity</para>
		/// <para>Output: </para>
		///</summary>
		protected IDbCommand CreateUpdateCommand(MenusEntity o){
			string strSQL="UPDATE  [Menus] SET [Menus].[ParentId]=@ParentId,[Menus].[ModuleId]=@ModuleId,[Menus].[MenuName]=@MenuName,[Menus].[Description]=@Description,[Menus].[IconName]=@IconName,[Menus].[MenuUrl]=@MenuUrl,[Menus].[DisplayIndex]=@DisplayIndex WHERE [Menus].[MenuId]=@MenuId";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullParentId)
				this.CreateCommandParameter(cmd,"@ParentId",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ParentId",o.ParentId);

			if(o.IsNullModuleId)
				this.CreateCommandParameter(cmd,"@ModuleId",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@ModuleId",o.ModuleId);

			if(o.IsNullMenuName)
				this.CreateCommandParameter(cmd,"@MenuName",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MenuName",o.MenuName);

			if(o.IsNullDescription)
				this.CreateCommandParameter(cmd,"@Description",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@Description",o.Description);

			if(o.IsNullIconName)
				this.CreateCommandParameter(cmd,"@IconName",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@IconName",o.IconName);

			if(o.IsNullMenuUrl)
				this.CreateCommandParameter(cmd,"@MenuUrl",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MenuUrl",o.MenuUrl);

			if(o.IsNullDisplayIndex)
				this.CreateCommandParameter(cmd,"@DisplayIndex",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@DisplayIndex",o.DisplayIndex);

			if(o.IsNullMenuId)
				this.CreateCommandParameter(cmd,"@MenuId",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MenuId",o.MenuId);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateUpdateFieldCommand</para>
		/// <para>Input: ColumnName,ColumnValue,MenuId</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateUpdateFieldCommand(string ColumnName,object Value,int MenuId){
			string strSQL="UPDATE  [Menus] SET [Menus].["+ColumnName+"]=@ColumnName WHERE [Menus].[MenuId]=@MenuId";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@MenuId",MenuId);



			this.CreateCommandParameter(cmd,"@ColumnName",Value);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: Update</para>
		/// <para>Input: MenusEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Update(MenusEntity o){
			IDbCommand cmd=this.CreateUpdateCommand(o);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateList</para>
		/// <para>Input: List of MenusEntity</para>
		/// <para>Output: </para>
		///</summary>
		public void UpdateList(List<MenusEntity>list){
			foreach(MenusEntity o in list){
				try{
					this.Update(o);
				}
				catch{
				}
			}
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateParentId</para>
		/// <para>Input: NewParentId,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateParentId(int NewParentId,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("ParentId",NewParentId,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateModuleId</para>
		/// <para>Input: NewModuleId,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateModuleId(int NewModuleId,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("ModuleId",NewModuleId,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateMenuName</para>
		/// <para>Input: NewMenuName,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateMenuName(string NewMenuName,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("MenuName",NewMenuName,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateDescription</para>
		/// <para>Input: NewDescription,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateDescription(string NewDescription,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("Description",NewDescription,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateIconName</para>
		/// <para>Input: NewIconName,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateIconName(string NewIconName,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("IconName",NewIconName,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateMenuUrl</para>
		/// <para>Input: NewMenuUrl,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateMenuUrl(string NewMenuUrl,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("MenuUrl",NewMenuUrl,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: UpdateDisplayIndex</para>
		/// <para>Input: NewDisplayIndex,MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool UpdateDisplayIndex(int NewDisplayIndex,int MenuId){
			IDbCommand cmd=this.CreateUpdateFieldCommand("DisplayIndex",NewDisplayIndex,MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		#endregion

		#region Delete functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: DeleteAllCommand</para>
		/// <para>Input: </para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteAllCommand(){
			string strSQL="DELETE   FROM [Menus]  ";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: DeleteCommand</para>
		/// <para>Input: MenusEntity</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteCommand(MenusEntity o){
			string strSQL="DELETE   FROM [Menus]   WHERE [Menus].[MenuId]=@MenuId";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			if(o.IsNullMenuId)
				this.CreateCommandParameter(cmd,"@MenuId",System.DBNull.Value);
			else
				this.CreateCommandParameter(cmd,"@MenuId",o.MenuId);


			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: DeleteAll</para>
		/// <para>Input: </para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool DeleteAll(){
			IDbCommand cmd=this.CreateDeleteAllCommand();
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateDeleteByPrimaryKeyCommand</para>
		/// <para>Input: MenuId</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteByPrimaryKeyCommand(int MenuId){
			string strSQL="DELETE   FROM [Menus]   WHERE [Menus].[MenuId]=@MenuId";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@MenuId",MenuId);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: CreateDeleteByKeyCommand</para>
		/// <para>Input: ColumnName , ColumnValue</para>
		/// <para>Output: IDbCommand</para>
		///</summary>
		protected IDbCommand CreateDeleteByKeyCommand(string ColumnName,object Value){
			string strSQL="DELETE   FROM [Menus]   WHERE [Menus].["+ColumnName+"]=@ColumnName";
			IDbCommand cmd=this.CreateCommand(strSQL);
			cmd.CommandType=CommandType.Text;
			this.CreateCommandParameter(cmd,"@ColumnName",Value);



			return cmd;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: Delete</para>
		/// <para>Input: MenusEntity</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool Delete(MenusEntity o){
			IDbCommand cmd=this.CreateDeleteCommand(o);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: DeleteByID</para>
		/// <para>Input: MenuId</para>
		/// <para>Output: return true if succeeded else return false</para>
		///</summary>
		public bool DeleteByID(int MenuId){
			IDbCommand cmd=this.CreateDeleteByPrimaryKeyCommand(MenuId);
			bool result=this.ExcuteNoneQuery(cmd);
			cmd.Dispose();
			return result;
		}
		#endregion

		#region Select join to MenusModules functions
		#endregion

		#region Select join to Menus functions
		#endregion

		#region Select join to Modules functions
		#endregion

		#region Select,delete by MenuId functions
		#endregion

		#region Select,delete by ParentId functions
		#endregion

		#region Select,delete by ModuleId functions
		#endregion

		#region MapObject functions
		///<summary>
		/// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
		/// <para>Date:09/03/2013 19:09:04</para>
		/// <para>Name: MapObject</para>
		/// <para>Input: IDataReader</para>
		/// <para>Output: MenusEntity</para>
		///</summary>
		protected override MenusEntity MapObject(IDataReader r){
			MenusEntity entity = new MenusEntity();
			try{
				if(r.FieldCount>0){
					try
					{
						int ordinal = r.GetOrdinal("MenuId");
						if (!r.IsDBNull(ordinal)) entity.MenuId = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("ParentId");
						if (!r.IsDBNull(ordinal)) entity.ParentId = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("ModuleId");
						if (!r.IsDBNull(ordinal)) entity.ModuleId = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("MenuName");
						if (!r.IsDBNull(ordinal)) entity.MenuName = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("Description");
						if (!r.IsDBNull(ordinal)) entity.Description = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("IconName");
						if (!r.IsDBNull(ordinal)) entity.IconName = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("MenuUrl");
						if (!r.IsDBNull(ordinal)) entity.MenuUrl = ((string)(r.GetValue(ordinal)));
					}
					catch{}
					try
					{
						int ordinal = r.GetOrdinal("DisplayIndex");
						if (!r.IsDBNull(ordinal)) entity.DisplayIndex = ((int)(r.GetValue(ordinal)));
					}
					catch{}
					return entity;
				}
			}catch{}
			return null;
		}
		#endregion
	}
	/*****************************************************************************************************/
	/**********************************END MenusDAOBase*****************************************/
	/*****************************************************************************************************/
}

